/*
 * Created on 27/02/2004
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package org.potiorb.orb.receive;

import java.io.IOException;
import java.net.*;

import org.potiorb.orb.iiop.EndPoint;
import org.potiorb.orb.poa.POA;

public class Acceptor extends Thread{
	private ServerSocket service;
	private ServiceHandle handle;
	private int port;
	private POA _poa;

	public Acceptor(int port, POA poa){
		this.port = port;
		this._poa = poa;
	}
	public void run(){
		try{
			int i = 0;
			service = new ServerSocket(this.port, 10);
			while (i <= 10)
			{
				handle = new ServiceHandle(new EndPoint(service.accept()),_poa);
				handle.start();
				i = i + 1;
			}
		}catch(IOException e){
			System.out.println("Error: Tring to connect socket");
		}
	}

}
